package com.yyb.learn.jbasics.basic.JAVA8;

import org.apache.http.HttpRequest;
import org.apache.http.client.methods.HttpPost;
import sun.plugin.javascript.navig.Array;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.function.BiFunction;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.function.Supplier;

/**
 * @Author yuyb40219
 * @Date 2021/10/26 16:40
 * Description:
 */
public class Test {

    public static void main(String[] args) {
//        Supplier<com.yyb.common.Test> supplier = com.yyb.common.Test::new;
//        com.yyb.common.Test test = supplier.get();
//        Function<String, com.yyb.common.Test> function = com.yyb.common.Test::new;
//        com.yyb.common.Test apply = function.apply("function-name");
//        com.yyb.common.Test apply1 = function.apply("function-name2");
//        System.out.println(apply == apply1);
//        System.out.println(apply.getName().equals(apply1.getName()));
//        BiFunction<Integer, String, com.yyb.common.Test> biFunction = com.yyb.common.Test::new;
//        List<String> strArr = Arrays.asList("1", "2", "3", "9", "5", "7", "6");

    }

    private static String processFile() throws IOException {
        try (BufferedReader br = new BufferedReader(new FileReader("data.txt"))) {
            return br.readLine();
        }
    }

    private static <T> List<T> filter(List<T> list, Predicate<T> p) {
        List<T> results = new ArrayList<>();
        for (T s : list) {
            if (p.test(s)) {
                results.add(s);
            }
        }
        return results;
    }
}